    define("pages/jls_yzdj/main", [
            "../../plugins/easyui/jquery-easyui-1.5.1/jquery.easyui.min",
            "../../plugins/easyui/jquery-easyui-1.5.1/easyloader",
            "../../plugins/artTemplate/artTemplate",
            "../../common/tools",
            "../../common/componts",
            "../../pages/jls_yzdj/form",
            "../../pages/jls_yzdj/YzdjShowHide.html.js",
        ],
        function(require) {
            var comonts=require("../../common/componts");
            var YzdjForm=require("../../pages/jls_yzdj/form");
            var tmp=require("../../pages/jls_yzdj/YzdjShowHide.html");
            var yzdjId="yzdjId";
            var selectid;
            var top="30px";
            var yzdj='yzdj';
            var initTable=function(){
                comonts.initTable(yzdjId,{
                    title: '验证登记',
                    url:"/jls_yzdj/yzdjList",
                    toolbar:'#tool',
                    firstLoad:true,
                    pageSize: 20,
                    columns:[
                        {field: 'oid',title: '',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="yzdjIdRadio" id="yzdjIdRadio"' + rowIndex + 'value="' + rowData.oid + '" />';}},
                        {
                            field : 'xm',
                            width : 150,
                            title:'姓名',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.xm == null ? "" : row.xm)+'</span>'
                            }},
                        {
                            field : 'xb',
                            width : 150,
                            title:'性别',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.xb == null ? "" : row.xb)+'</span>'
                            }},
                        {
                            field : 'zjlx',
                            width : 150,
                            title:'证件类型',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.zjlx == null ? "" : row.zjlx)+'</span>'
                            }},
                        {
                            field : 'zjh',
                            width : 150,
                            title:'证件号',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.zjh == null ? "" : row.zjh)+'</span>'
                            }},
                        {
                            field : 'csrq',
                            width : 150,
                            title:'出生日期',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.csrq == null ? "" : row.csrq)+'</span>'
                            }},
                        {
                            field : 'mz',
                            width : 150,
                            title:'民族',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.mz == null ? "" : row.mz)+'</span>'
                            }},
                        {
                            field : 'hyzk',
                            width : 150,
                            title:'婚姻状况',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.hyzk == null ? "" : row.hyzk)+'</span>'
                            }},
                        {
                            field : 'whcd',
                            width : 150,
                            title:'文化程度',
                            sortable:'true',
                            formatter: function(value,row,index){
                                return '<span title='+value+'>'+(row.whcd == null ? "" : row.whcd)+'</span>'
                            }},
                        ],
                    detailFormatter:function(index,rowData){
                        return '<table style="height:40px;width:100%"><tr><td><strong></strong></td></tr></table>'
                    },
                    onClickRow:function(rowIndex, rowData){
                        if (selectid != rowData.id) {
                            $("input[name='yzdjIdRadio']")[rowIndex].checked = true;
                            $('#' + yzdjId).datagrid("selectRow", rowIndex);
                            selectid = rowData.id;
                        } else if (selectid == rowData.id) {
                            $('#' + yzdjId).datagrid("unselectRow", rowIndex);
                            $("input[name='yzdjIdRadio']")[rowIndex].checked = false;
                            selectid = "";
                        }
                    },
                });
                $('#yzdjId').datagrid('resize', {
                    height: ($(window).height()-35 )
                });
            }
            var findYzdj=function(){
                var opts = $('#'+yzdjId).datagrid("options");
                opts.url = "/jls_jbxx/jbxxList";
                $('#'+yzdjId).datagrid('clearSelections');
                $('#'+yzdjId).datagrid('load',{
                });
            }
           var addValue=function (){
               var row = $('#yzdjId').datagrid('getSelected');
               var ss=JSON.stringify(row);
               console.log("d=="+ss+"=;;");
               if(row){
                   $('#yzdj_rybh').textbox('setValue',row.rybh);
                   $('#yzdj_xmtype').textbox('setValue',row.xm);
                   $('#yzdj_xbtype').textbox('setValue',row.xb).combobox("setText",row.xbString);
               }
            }
            var bindAction=function(){
                //查询
                $("#yzdj_search").on("click",function(){
                    findYzdj();
                });
                //新增
                $("#yzdj_add").on("click",function(){
                    var Yzdj=$("#"+yzdjId).datagrid('getSelected');
                    /*if(Yzdj){*/
                        YzdjForm.show(findYzdj,Yzdj);
                        addValue();
                    /*}else{
                        $.messager.alert("提示","请选择要验证登记的人!","info");
                    }*/
                });
                //修改
                $("#yzdj_update").on("click",function(){
                    var Yzdj=$("#"+yzdjId).datagrid('getSelected');
                        YzdjForm.show(findYzdj,Yzdj);

                });
                $("#yzdj_zrs").on("click",function(){
                    window.location.href="/jls_ryjs/index.html";
                });
                $("#yzdj_xz").on("click",function(){
                    var Yzdj=$("#"+yzdjId).datagrid('getSelected');
                    if(Yzdj){
                        YzdjForm.show(findYzdj,Yzdj);
                    }else{
                        $.messager.alert("提示","请选择要操作的记录!","info");
                    }
                });
                $("#yzdj_gxws").on("click",function(){
                    var Yzdj=$("#"+yzdjId).datagrid('getSelected');
                    if(Yzdj){
                        YzdjForm.show(findYzdj,Yzdj);
                    }else{
                        $.messager.alert("提示","请先选择要更新的文书记录!","info");
                    }
                });

                //删除
                $("#yzdj_remove").on("click",function(){
                    //把你选中的 数据查询出来。
                    var selectRows = $('#yzdjId').datagrid("getSelections");
                    if(selectRows==null||selectRows==undefined){

                        return  $.messager.alert("提示消息", "请选中要删的数据!");
                    }else{
                        $.messager.confirm("操作提示", "您确定要删除该条记录吗？", function (data) {

                            if(data) {
                                submitLoad();
                                $.ajax({
                                    type : "POST",  //提交方式
                                    url : "/jls_yzdj/yzdjDelete",//路径
                                    data : {id:selectRows[0].id},//数据，这里使用的是Json格式进行传输
                                    success : function(result) {
                                        if (result.success) {
                                            $.messager.alert("确定","删除成功","info");
                                            findYzdj();
                                        }else{
                                            removeLoad();
                                            $.messager.alert("确定","删除失败","info");
                                        }
                                    },
                                    complete:function(){
                                        removeLoad();
                                    },
                                });
                            }else {
                                return false;
                            }

                        });

                    }
                });
                comonts.ShowHide(yzdj,tmp);
            }
            var initView=function(){
                initTable();
                bindAction();
            }
            initView();

        });